/*
 * Copyright 2014 Graham Smith
 */
package uk.co.wobblycogs.vegas;

import java.nio.file.Path;
import java.nio.file.Paths;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 *
 * @author Graham Smith
 */
@Converter(autoApply = true)
public class PathConverter implements AttributeConverter<Path, String> {

	public PathConverter() {
	}

	@Override
	public String convertToDatabaseColumn(Path path) {
		return path.toString();
	}

	@Override
	public Path convertToEntityAttribute(String path) {
		return Paths.get(path);
	}

}
